home *** CD-ROM | disk | FTP | other *** search
- property theLength, firstRecordingSprNumber, frameCounterMinH, frameNumberMinH, firstKrustyCastNumber, lastKrustyCastNumber, stopButtonCastNumber, theSoundLoop, theFrameNumber, thePreviousSoundLoop, thePreviousSoundFx, theScoreLength, sndLoopDataCnt, sndFXDataCnt, sndLoopDataLast, bgdDataCnt, bgdFXDataCnt, fgdFXDataCnt
- global shuttleSpr, shuttleFldSpr, backgroundSpr, playBtnSpr, foregroundFXSpr, backgroundFXSpr, creditSpr, scoreData, dispatchTable, currentFrame, bgdData, fgdFXData, bgdFXData, soundFXData, soundLoopData, PCflag, gLoopFlag, gStopFlag
-
- on birth me
- set backgroundSpr to 1
- set creditSpr to 23
- puppetSprite(creditSpr, 1)
- formatTextFields(me)
- puppetSprites(2, 14, 1)
- set firstRecordingSprNumber to 3
- set theLength to 235.0
- set frameCounterMinH to 194
- set frameNumberMinH to 180
- set firstKrustyCastNumber to the number of cast "first krusty"
- set lastKrustyCastNumber to the number of cast "last krusty" - 1
- set stopButtonCastNumber to the number of cast "stop button"
- set theUnloadList to []
- return me
- end
-
- on playBackClip me, startFrame
- set gStopFlag to 0
- set theScoreLength to count(scoreData)
- set sndLoopDataCnt to count(soundLoopData)
- set sndLoopDataLast to getLast(soundLoopData)
- set sndFXDataCnt to count(soundFXData)
- set bgdFXDataCnt to count(bgdFXData)
- set bgdDataCnt to count(bgdData)
- set fgdFXDataCnt to count(fgdFXData)
- set thePreviousSoundFx to [EMPTY, 0]
- set thePreviousSoundLoop to [EMPTY, 0]
- if (startFrame < theScoreLength) or gLoopFlag then
- if (startFrame <> 1) or (theScoreLength <> 1) then
- repeat with theFrameNumber = startFrame to theScoreLength
- startTimer()
- if stopPlayBack(me) then
- exit
- end if
- playBackSoundLoop(me)
- playBackSoundFX(me)
- playBackBackgrounds(me)
- playBackBackgroundFX(me)
- playBackScoreData(me)
- playBackForegroundFX(me)
- updateStage()
- if stopPlayBack(me) then
- exit
- end if
- setKrusty(me)
- set currentFrame to currentFrame + 1
- repeat while the timer < 5
- end repeat
- if stopPlayBack(me) then
- exit
- end if
- end repeat
- repeat while gLoopFlag
- resetKrusty(me)
- set thePreviousSoundFx to [EMPTY, 0]
- repeat with theFrameNumber = 1 to theScoreLength
- startTimer()
- if stopPlayBack(me) then
- exit
- end if
- playBackSoundLoop(me)
- playBackSoundFX(me)
- playBackBackgrounds(me)
- playBackBackgroundFX(me)
- playBackScoreData(me)
- playBackForegroundFX(me)
- updateStage()
- if stopPlayBack(me) then
- exit
- end if
- setKrusty(me)
- set currentFrame to currentFrame + 1
- repeat while the timer < 5
- end repeat
- if stopPlayBack(me) then
- exit
- end if
- end repeat
- end repeat
- set currentFrame to currentFrame - 1
- end if
- end if
- if soundBusy(1) then
- puppetSound(1, 0)
- end if
- if soundBusy(2) then
- puppetSound(2, 0)
- end if
- playBtnClick(interfaceMgr, playBtnSpr)
- end
-
- on playBackSoundLoop me
- if sndLoopDataCnt >= theFrameNumber then
- if theFrameNumber > 1 then
- set thePreviousSoundLoop to getAt(soundLoopData, theFrameNumber - 1)
- end if
- set theSoundLoop to getAt(soundLoopData, theFrameNumber)
- set soundLoopCastNum to getAt(theSoundLoop, 2)
- if getAt(thePreviousSoundLoop, 2) <> soundLoopCastNum then
- puppetSound(1, soundLoopCastNum)
- set the text of field "loopStatusField" to getAt(theSoundLoop, 1)
- else
- if not soundBusy(1) then
- puppetSound(1, soundLoopCastNum)
- end if
- end if
- else
- set thePreviousSoundLoop to sndLoopDataLast
- if not soundBusy(1) then
- puppetSound(1, getAt(thePreviousSoundLoop, 2))
- end if
- end if
- end
-
- on playBackSoundFX me
- if sndFXDataCnt >= theFrameNumber then
- if theFrameNumber > 1 then
- set thePreviousSoundFx to getAt(soundFXData, theFrameNumber - 1)
- end if
- set theSoundFX to getAt(soundFXData, theFrameNumber)
- set soundFXCastNum to getAt(theSoundFX, 2)
- if getAt(thePreviousSoundFx, 2) <> soundFXCastNum then
- if soundFXCastNum <> 0 then
- puppetSound(2, soundFXCastNum)
- end if
- end if
- set the text of field "soundStatusField" to getAt(theSoundFX, 1)
- else
- set the text of field "soundStatusField" to EMPTY
- end if
- end
-
- on playBackBackgrounds me
- if bgdDataCnt >= theFrameNumber then
- set theBackground to getAt(bgdData, theFrameNumber)
- set the castNum of sprite 1 to getAt(theBackground, 1)
- set the loc of sprite 1 to point(getAt(theBackground, 2), getAt(theBackground, 3))
- end if
- end
-
- on playBackBackgroundFX me
- if bgdFXDataCnt >= theFrameNumber then
- set theBackgroundFX to getAt(bgdFXData, theFrameNumber)
- if theBackgroundFX <> [EMPTY, 0] then
- set the castNum of sprite 2 to getAt(theBackgroundFX, 2)
- set the loc of sprite 2 to point(313, 218)
- else
- set the locH of sprite 2 to -1000
- end if
- else
- set the locH of sprite 2 to -1000
- end if
- end
-
- on playBackScoreData me
- set basePlayBackSpr to firstRecordingSprNumber
- set theFrame to getAt(scoreData, theFrameNumber)
- repeat with theLayer in dispatchTable
- set curDataChannel to getAt(theLayer, 3)
- set curclip to getaProp(theFrame, curDataChannel)
- if not (curclip = EMPTY) then
- set the castNum of sprite basePlayBackSpr to getAt(curclip, 1)
- set the loc of sprite basePlayBackSpr to point(getAt(curclip, 2), getAt(curclip, 3))
- else
- set the locH of sprite basePlayBackSpr to -1000
- end if
- set basePlayBackSpr to basePlayBackSpr + 1
- end repeat
- end
-
- on playBackForegroundFX me
- if fgdFXDataCnt >= theFrameNumber then
- set theforegroundFX to getAt(fgdFXData, theFrameNumber)
- if not (theforegroundFX = EMPTY) then
- set the castNum of sprite foregroundFXSpr to getAt(theforegroundFX, 1)
- set the loc of sprite foregroundFXSpr to point(getAt(theforegroundFX, 2), getAt(theforegroundFX, 3))
- else
- set the locH of sprite foregroundFXSpr to -1000
- end if
- else
- set the locH of sprite foregroundFXSpr to -1000
- end if
- end
-
- on displaySoundName me
- if sndLoopDataCnt >= theFrameNumber then
- set theSoundLoop to getAt(soundLoopData, theFrameNumber)
- set the text of field "loopStatusField" to getAt(theSoundLoop, 1)
- end if
- if sndFXDataCnt >= theFrameNumber then
- set theSoundFX to getAt(soundFXData, theFrameNumber)
- set the text of field "soundStatusField" to getAt(theSoundFX, 1)
- else
- set the text of field "soundStatusField" to EMPTY
- end if
- end
-
- on stopPlayBack me
- if the mouseDown then
- if the mouseCast = stopButtonCastNumber then
- if soundBusy(1) then
- puppetSound(1, 0)
- end if
- if soundBusy(2) then
- puppetSound(2, 0)
- end if
- playBtnClick(interfaceMgr, playBtnSpr)
- return 1
- end if
- end if
- if the shiftDown then
- if soundBusy(1) then
- puppetSound(1, 0)
- end if
- if soundBusy(2) then
- puppetSound(2, 0)
- end if
- playBtnClick(interfaceMgr, playBtnSpr)
- return 1
- end if
- return 0
- end
-
- on setKrustyForRecording me
- set numberOfFrames to count(scoreData)
- if currentFrame > numberOfFrames then
- set numberOfFrames to currentFrame
- end if
- if numberOfFrames > 1 then
- set theDivisor to numberOfFrames - 1
- set theIncrement to float(theLength) / float(theDivisor)
- set theDistance to float(currentFrame - 1) * theIncrement
- if the castNum of sprite shuttleSpr > lastKrustyCastNumber then
- set the castNum of sprite shuttleSpr to firstKrustyCastNumber
- else
- set the castNum of sprite shuttleSpr to the castNum of sprite shuttleSpr + 1
- end if
- set the text of field "frameNumber" to string(currentFrame)
- set the locH of sprite shuttleSpr to frameCounterMinH + theDistance
- set the locH of sprite shuttleFldSpr to frameNumberMinH + theDistance
- else
- resetKrusty(me)
- end if
- end
-
- on incrementCounter me
- if the castNum of sprite shuttleSpr > lastKrustyCastNumber then
- set the castNum of sprite shuttleSpr to firstKrustyCastNumber
- else
- set the castNum of sprite shuttleSpr to the castNum of sprite shuttleSpr + 1
- end if
- set the text of field "frameNumber" to string(currentFrame)
- end
-
- on setKrusty me
- set numberOfFrames to count(scoreData)
- if numberOfFrames > 1 then
- if the castNum of sprite shuttleSpr > lastKrustyCastNumber then
- set the castNum of sprite shuttleSpr to firstKrustyCastNumber
- else
- set the castNum of sprite shuttleSpr to the castNum of sprite shuttleSpr + 1
- end if
- set theDivisor to numberOfFrames - 1
- set theIncrement to float(theLength) / float(theDivisor)
- set theDistance to float(currentFrame - 1) * theIncrement
- set the text of field "frameNumber" to string(currentFrame)
- set the locH of sprite shuttleSpr to frameCounterMinH + theDistance
- set the locH of sprite shuttleFldSpr to frameNumberMinH + theDistance
- else
- resetKrusty(me)
- end if
- end
-
- on updateKrusty me
- set theDivisor to float(count(scoreData))
- if theDivisor > 0 then
- set theIncrement to theLength / theDivisor
- end if
- if theIncrement < 1.0 then
- set theIncrement to 1.0
- end if
- if the castNum of sprite shuttleSpr > lastKrustyCastNumber then
- set the castNum of sprite shuttleSpr to firstKrustyCastNumber
- else
- set the castNum of sprite shuttleSpr to the castNum of sprite shuttleSpr + 1
- end if
- set the text of field "frameNumber" to string(currentFrame)
- if the locH of sprite shuttleSpr <= (frameCounterMinH + theLength) then
- set the locH of sprite shuttleSpr to the locH of sprite shuttleSpr + theIncrement
- set the locH of sprite shuttleFldSpr to the locH of sprite shuttleFldSpr + theIncrement
- end if
- end
-
- on resetKrusty me
- set the text of field "frameNumber" to "1"
- set the locH of sprite shuttleSpr to frameCounterMinH
- set the locH of sprite shuttleFldSpr to frameNumberMinH
- resetFrameCounter()
- end
-
- on showFrame me, whichFrame, theFilterSlot
- set theFilterSlotMinus2 to theFilterSlot - 2
- showFrameBackground(me, whichFrame)
- if theFilterSlot <> backgroundFXSpr then
- showFrameBackgroundFX(me, whichFrame)
- end if
- set theFrame to getAt(scoreData, whichFrame)
- set basePlayBackSpr to firstRecordingSprNumber
- set dispatchTableCount to count(dispatchTable)
- repeat with theLayer = 1 to dispatchTableCount
- if theFilterSlotMinus2 <> theLayer then
- showFrameLayer(me, theLayer, basePlayBackSpr, theFrame)
- end if
- set basePlayBackSpr to basePlayBackSpr + 1
- end repeat
- if dispatchTableCount < 12 then
- repeat with theLayer = dispatchTableCount + 1 to 12
- set the locH of sprite basePlayBackSpr to -1000
- set basePlayBackSpr to basePlayBackSpr + 1
- end repeat
- end if
- if theFilterSlot <> foregroundFXSpr then
- showFrameForegroundFX(me, whichFrame)
- end if
- displaySound(me, whichFrame)
- updateStage()
- end
-
- on showFrameLayer me, theLayer, basePlayBackSpr, theFrame
- set curclip to getaProp(theFrame, getAt(getAt(dispatchTable, theLayer), 3))
- if curclip = EMPTY then
- set the locH of sprite basePlayBackSpr to -1000
- else
- set the castNum of sprite basePlayBackSpr to getAt(curclip, 1)
- set the loc of sprite basePlayBackSpr to point(getAt(curclip, 2), getAt(curclip, 3))
- end if
- end
-
- on showFrameBackground me, whichFrame
- if whichFrame <= count(bgdData) then
- set theBackground to getAt(bgdData, whichFrame)
- else
- set theBackground to getLast(bgdData)
- end if
- set the castNum of sprite 1 to getAt(theBackground, 1)
- set the loc of sprite 1 to point(getAt(theBackground, 2), getAt(theBackground, 3))
- end
-
- on showFrameBackgroundFX me, whichFrame
- if whichFrame <= count(bgdFXData) then
- set theBackgroundFX to getAt(bgdFXData, whichFrame)
- if theBackgroundFX = [EMPTY, 0] then
- set the locH of sprite 2 to -1000
- else
- set the castNum of sprite 2 to getAt(theBackgroundFX, 2)
- set the loc of sprite 2 to point(313, 218)
- end if
- else
- set the locH of sprite 2 to -1000
- end if
- end
-
- on showFrameForegroundFX me, whichFrame
- if whichFrame <= count(fgdFXData) then
- set theforegroundFX to getAt(fgdFXData, whichFrame)
- if theforegroundFX = EMPTY then
- set the locH of sprite foregroundFXSpr to -1000
- else
- set the castNum of sprite foregroundFXSpr to getAt(theforegroundFX, 1)
- set the loc of sprite foregroundFXSpr to point(getAt(theforegroundFX, 2), getAt(theforegroundFX, 3))
- end if
- else
- set the locH of sprite foregroundFXSpr to -1000
- end if
- end
-
- on displaySound me, whichFrame
- if whichFrame <= count(soundLoopData) then
- set the text of field "loopStatusField" to getAt(getAt(soundLoopData, whichFrame), 1)
- else
- set the text of field "loopStatusField" to getAt(getLast(soundLoopData), 1)
- end if
- if whichFrame <= count(soundFXData) then
- set the text of field "soundStatusField" to getAt(getAt(soundFXData, whichFrame), 1)
- else
- set the text of field "soundStatusField" to EMPTY
- end if
- end
-
- on rewind me
- if count(scoreData) > 0 then
- showFrame(me, 1, 0)
- resetKrusty(me)
- updateStage()
- end if
- end
-
- on fastForward me
- set lastFrame to count(scoreData)
- if lastFrame > 0 then
- set currentFrame to lastFrame
- showFrame(me, lastFrame, 0)
- setKrusty(me)
- updateStage()
- end if
- end
-
- on stepBack me
- if currentFrame > 1 then
- decrementFrame()
- showFrame(me, currentFrame, 0)
- setKrusty(me)
- updateStage()
- end if
- end
-
- on stepForward me
- if currentFrame < count(scoreData) then
- incrementFrame()
- showFrame(me, currentFrame, 0)
- setKrusty(me)
- updateStage()
- end if
- end
-
- on moveKrusty me
- if (the mouseH < (frameCounterMinH - 15)) or (the mouseH > (frameCounterMinH + theLength + 15)) then
- exit
- end if
- set theScoreLength to count(scoreData)
- if theScoreLength > 1 then
- set theDivisor to float(theScoreLength + 1)
- if theDivisor > 0 then
- set theIncrement to theLength / theDivisor
- end if
- repeat while the mouseDown
- if the mouseH <= frameCounterMinH then
- rewind(me)
- next repeat
- end if
- if the mouseH >= (frameCounterMinH + theLength) then
- fastForward(me)
- next repeat
- end if
- set the locH of sprite shuttleSpr to the mouseH
- set the locH of sprite shuttleFldSpr to the mouseH - 13
- set whichFrame to integer((the locH of sprite shuttleSpr - frameCounterMinH) / theIncrement)
- if whichFrame < 1 then
- set whichFrame to 1
- else
- if whichFrame > theScoreLength then
- set whichFrame to theScoreLength
- end if
- end if
- if whichFrame <= theScoreLength then
- if currentFrame < whichFrame then
- if the castNum of sprite shuttleSpr >= lastKrustyCastNumber then
- set the castNum of sprite shuttleSpr to firstKrustyCastNumber
- else
- set the castNum of sprite shuttleSpr to the castNum of sprite shuttleSpr + 1
- end if
- else
- if currentFrame > whichFrame then
- if the castNum of sprite shuttleSpr <= firstKrustyCastNumber then
- set the castNum of sprite shuttleSpr to lastKrustyCastNumber
- else
- set the castNum of sprite shuttleSpr to the castNum of sprite shuttleSpr - 1
- end if
- end if
- end if
- set currentFrame to whichFrame
- set the text of field "frameNumber" to string(currentFrame)
- updateStage()
- showFrame(me, whichFrame, 0)
- end if
- end repeat
- end if
- end
-
- on preview me
- set backgroundSprH to the locH of sprite 1
- set the locH of sprite 1 to -1000
- repeat with i = 2 to 14
- set the castNum of sprite i to the number of cast "placeholder cast"
- set the locH of sprite i to -1000
- end repeat
- set the castNum of sprite 16 to the number of cast "placeholder cast"
- set the locH of sprite 16 to -1000
- set creditRect to the rect of sprite creditSpr
- set creditHeight to getAt(creditRect, 4) - getAt(creditRect, 2)
- doTitleFade(me, creditHeight)
- doCreditScroll(me, creditHeight)
- set the locH of sprite 1 to backgroundSprH
- rewind(me)
- playBackClip(me, 1)
- end
-
- on doTitleFade me, creditHeight
- set theCreditCast to the castNum of sprite creditSpr
- set theTitle to getCurrentCartoonName(fileMgr)
- set the text of field "creditScreenField" to theTitle
- set the textSize of field "creditScreenField" to 36
- set the loc of sprite creditSpr to point(85, 190)
- repeat with theColor = 255 down to 245
- set the foreColor of cast theCreditCast to theColor
- updateStage()
- end repeat
- set titleTime to 60 + (length(theTitle) * 5)
- set freeze to the timer
- repeat while the timer < (freeze + titleTime)
- if the mouseDown then
- exit repeat
- end if
- end repeat
- repeat with theColor = 245 to 255
- set the foreColor of cast theCreditCast to theColor
- updateStage()
- end repeat
- set the locH of sprite creditSpr to -1000
- updateStage()
- end
-
- on doCreditScroll me, creditHeight
- set theCredits to getCurrentCartoonCredits(fileMgr)
- if theCredits <> EMPTY then
- set defaultCredits to RETURN & "PUT" & RETURN & RETURN & "YOUR" & RETURN & RETURN & "CREDITS" & RETURN & RETURN & "HERE"
- if theCredits <> defaultCredits then
- set theCreditCast to the castNum of sprite creditSpr
- set the text of field "creditScreenField" to theCredits
- set the textSize of field "creditScreenField" to 24
- set the foreColor of cast theCreditCast to 9
- set topEdge to 36
- set bottomEdge to 401
- set the loc of sprite creditSpr to point(85, bottomEdge)
- updateStage()
- set limit to topEdge - creditHeight
- repeat while the locV of sprite creditSpr > limit
- set the locV of sprite creditSpr to the locV of sprite creditSpr - 3
- updateStage()
- if the mouseDown then
- exit repeat
- end if
- end repeat
- set the locH of sprite creditSpr to -1000
- updateStage()
- end if
- end if
- end
-
- on formatTextFields me
- if PCflag then
- set the textFont of field "frameNumber" to "Arial"
- set the textSize of field "frameNumber" to 9
- set the textStyle of field "frameNumber" to "plain"
- set the textFont of field "creditScreenField" to "Arial"
- set the textSize of field "creditScreenField" to 36
- set the textStyle of field "creditScreenField" to "bold"
- else
- set the textFont of field "frameNumber" to "Geneva"
- set the textSize of field "frameNumber" to 9
- set the textStyle of field "frameNumber" to "plain"
- set the textFont of field "creditScreenField" to "Geneva"
- set the textSize of field "creditScreenField" to 36
- set the textStyle of field "creditScreenField" to "bold"
- end if
- end
-
- on previewSound me, theCategory, currentBank, paletteIndex
- puppetSound(1, 0)
- puppetSound(2, 0)
- set clipDataField to theCategory & "data"
- set currentClipLine to ((currentBank - 1) * 10) + paletteIndex
- set curClipRecord to value(line currentClipLine of field clipDataField)
- if listp(curClipRecord) then
- set soundCastNum to getAt(curClipRecord, 3)
- puppetSound(1, soundCastNum)
- else
- put "no clip record available"
- end if
- end
-